package com.kitten.relation_user.biz.domain.mapper;

import com.kitten.relation_user.biz.domain.dataobject.FollowingDO;
import org.apache.ibatis.annotations.Param;

import java.util.List;


public interface FollowingDOMapper {
    int deleteByPrimaryKey(Long id);

    int insert(FollowingDO record);

    int insertSelective(FollowingDO record);

    FollowingDO selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(FollowingDO record);

    int updateByPrimaryKey(FollowingDO record);

    /**
     * 根据用户id查询关注列表
     * @param userId
     * @return
     */
    List<FollowingDO> selectByUserId(Long userId);

    /**
     * 删除关注信息
     * @param userId
     * @param unfollowingUserId
     * @return
     */
    int deleteByUserIdAndFollowingUserId(@Param("userId") Long userId,
                                         @Param("unfollowingUserId") Long unfollowingUserId);

    /**
     * 根据用户id 查询关注数量
     * @param userId
     * @return
     */
    long selectCountByUserId(Long userId);

    /**
     * 根据用户id查询关注列表 (分页)
     * @param userId
     * @param offset
     * @param limit
     * @return
     */
    List<FollowingDO> selectPageListByUserId(@Param("userId") Long userId,
                                            @Param("offset") Long offset,
                                            @Param("limit") Long limit);

    /**
     * 根据userId查询关注列表 (全部)
     * @param userId
     * @return
     */
    List<FollowingDO> selectAllByUserId(Long userId);

}